﻿using Autofac;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using YJM.ModbusMonitor.GUI.Core;
using YJM.ModbusMonitor.GUI.Views;

namespace YJM.ModbusMonitor.GUI.ViewModels
{
    public class MainWindowViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        #region 属性
        private FrameworkElement page = new DataMonitorView();
        public FrameworkElement Page
        {
            get { return page; }
            set
            {
                page = value;
                if (this.PropertyChanged != null)
                {
                    this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Page"));//当Name的属性值发生改变时，PropertyChanged事件触发
                }
            }
        }
        #endregion


        #region 命令
        public BaseCommand NaviCommand
        {
            get
            {
                return new BaseCommand(s =>
                {
                    Page = AFContainer.getInstance().ResolveNamed<UserControl>(s as string);
                });
            }
        }
        #endregion
    }
}
